import * as tslib_1 from "tslib";
import { observable, action } from "mobx";
import request from "../utils/request";
import * as api from "../api/api";
import { LoadHoc, loading } from "../hoc/loadHoc";
// 建企商学院
let BusinessSchool = class BusinessSchool extends LoadHoc {
  constructor() {
    super(...arguments);
    /**
     * 课程类别信息
     */
    this.allCategories = {};
    /**
     * 所有课程信息
     */
    this.allCourseInformation = {};
    /**
     * 所有课程详情
     */
    this.courseInformation = {};
    /**
     * 所有课程章节信息
     */
    this.courseChapterInfo = {};
  }
  async getAllCategories(params) {
    const { callback } = params;
    const allCategories = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolGetAllCategoriesAsync({}));
    this.allCategories = allCategories;
    callback && callback(allCategories);
  }
  async getAllCourseInformation(params) {
    const { cateGoryId, pageIndex, pageSize, callback } = params;
    const allCourseInformation = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolGetAallCourseInformationAsync({
      formCateGoryId: cateGoryId,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.allCourseInformation = allCourseInformation;
    callback && callback(allCourseInformation);
  }
  async getCourseInformation(params) {
    const { id, callback } = params;
    const courseInformation = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolGetCourseInformationInfoAsync({
      formId: id
    }));
    this.courseInformation = courseInformation;
    callback && callback(courseInformation);
  }
  async getCourseChapterInfo(params) {
    const { formType, courseId, pageIndex, pageSize, callback } = params;
    const courseChapterInfo = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolGetCourseChapterInfoAsync({
      formType,
      formCourseId: courseId,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.courseChapterInfo = courseChapterInfo;
    callback && callback(courseChapterInfo);
  }
  /**
   * 保存报名信息
   */
  async saveApplyInfoAsync(params) {
    const { form, callback } = params;
    const res = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolSaveApplyInfoAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   * 购买课程
   */
  async buyCourse(params) {
    const { form, callback } = params;
    const res = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolBuyCourseAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   * 获取报名人数信息
   */
  async getBusinessSchoolRegistCount(params) {
    const { callback } = params;
    const businessSchoolRegistCount = await request(api.AppbusinessSchoolApiFetchParamCreactor.appbusinessSchoolGetBusinessSchoolRegistCountAsync({}));
    callback && callback(businessSchoolRegistCount);
  }
};
export { BusinessSchool as default };

tslib_1.__decorate([observable], BusinessSchool.prototype, "allCategories", undefined);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "getAllCategories", null);
tslib_1.__decorate([observable], BusinessSchool.prototype, "allCourseInformation", undefined);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "getAllCourseInformation", null);
tslib_1.__decorate([observable], BusinessSchool.prototype, "courseInformation", undefined);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "getCourseInformation", null);
tslib_1.__decorate([observable], BusinessSchool.prototype, "courseChapterInfo", undefined);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "getCourseChapterInfo", null);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "saveApplyInfoAsync", null);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "buyCourse", null);
tslib_1.__decorate([loading, action], BusinessSchool.prototype, "getBusinessSchoolRegistCount", null);